package ubadb.core.components.bufferManager.bufferPool.replacementStrategies.touchcount;

import java.util.Date;

import ubadb.core.components.bufferManager.bufferPool.BufferFrame;
import ubadb.core.common.Page;
import ubadb.core.exceptions.BufferFrameException;

public class TouchBufferFrame extends BufferFrame {
	private int count;
	private Date lastTouch;
	
	public TouchBufferFrame(Page page) {
		super(page);
		count = 0;
		lastTouch = new Date();
	}

	public void unpin() throws BufferFrameException {
		super.unpin();
		Date tempDate = new Date();
		
		//if (((tempDate.getTime()-lastTouch.getTime())/1000)>=3)
		//{
			lastTouch = tempDate;
			count++;
		//}
	}
	
	public int getCount()
	{
		return count;
	}
	
	public void setCount(int i) {
		count = i;
		
	}
}
